package com.thinkingcoder.tcgateway.web.filter;

import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;

import reactor.core.publisher.Mono;

/**
 * Gateway POST WebFilter.
 */
@Component("gatewayPostWebFilter")
public class GatewayPostWebFilter implements WebFilter {

    @Override
    public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
        return chain.filter(exchange).doFinally(s -> {
            System.out.println(" ===>>> TC-Gateway POST WebFilter ");
            exchange.getAttributes().forEach((k, v) -> {
                System.out.println(k + " : " + v);
            });
        });
    }

}
